package 力扣日常刷题.木23一月.第11天311;
import 力扣日常刷题.TreeNode;


/**
 * @author 帅小伙
 * @date 2022/3/11
 * @description
 */
public class Demo44对称的二叉树 {

    public boolean isSymmetric(TreeNode root) {
        if(root == null) return true;
        return isSymmetric(root,root);
    }

    public boolean isSymmetric(TreeNode left,TreeNode right) {
        if(left == null && right == null) return true;
        if(left == null || right == null || left.val != right.val) return false;
        return isSymmetric(left.left,right.right) && isSymmetric(left.right,right.left);
    }

}
